<?php $baseUrl = Yii::app()->baseUrl; ?> 
<div class="dialog_title">
    <a class="dialog_x">X</a>
    <h1>New Expense</h1>
</div>
<div id="topMenu">
    <form id="topMenuForm">
        <label>
            Customer(*)
            <select style="width:350px;" name="customer">
                <option value="0">--Customer--</option>
                <?php foreach ($customers as $customer): ?>
                    <option value="<?php echo $customer['Id'] ?>"><?php echo $customer['CustomerName']; ?></option>
                <?php endforeach; ?>
            </select>
        </label>
        <label>SRF(*) <input type="text" name="SRF" size="50" /></label>
        <input type="checkbox" name="billable" id="billable" size="50" value="1"/><label for="billable">Billable</label>
    </form>
</div>
<!-- New Expense Tab Panes -->
<div class="dialog_wrapper">
    <div id="newExpense3_panes">

        <!-- One Tab -->
        <div style="display: block;" class="newExpense3_one">

            <!-- Few Tab -->
            <div  class="newExpense3_few">
                <!-- Few Modes -->
                <ul class="smallTabs">
                    <li id="expense_tab" class="first current"><a>Expense</a></li>
                    <li id="mileage_tab" class="" ><a>Mileage</a></li>
                    <li id="time_tab"><a>Time</a></li>
                    <li id="multiple_tab" style="display: list-item;" class="hidden last"><a>Multiple</a></li>
                </ul> 
                <input type="hidden" id="newExpenseCurrentTab" name="newExpenseCurrentTab" value="expense_tab">
                <div class="smallTabs_content">
                    <!-- One Expense -->
                    <div class="floatWrapper">

                        <div class="floatLeft width50 smallTabs_content" id ="smallTabs_content_left">
                            <div class="js_modeContainer" id="newExpense3_expenseForm">

                                <form style="display: block;" id="expenseNewExpense" class="form short-labels js_modeContainer">
                                    <ol>
                                        <li>
                                            <label>Date</label>
                                            <input value="<?php echo date('Y-m-d') ?>" id="created" name="created" class="required calendar semwal_dtpicker" type="text">
                                        </li>
                                        <li>
                                            <label>Merchant</label>
                                            <input value="" id="newExpense3_oneExpense_merchant" name="merchant" type="text" maxlength="255">
                                        </li>                                          
                                        <li>
                                            <label>Currency</label>
                                            <input type="hidden" id="newExpense3_oneExpense_currency_old" value="<?php echo $defaultPreference['CurrencyId']; ?>">
                                            <select id="newExpense3_oneExpense_currency" name="expenseCurrency" class="short">
                                                <?php foreach ($currencies as $currency): ?>
                                                    <?php if ($currency['Id'] == $defaultPreference['CurrencyId']): ?>
                                                        <option value="<?php echo $currency['Id'] ?>" selected="selected"><?php echo $currency['CurrencyName']; ?></option>
                                                    <?php else: ?>
                                                        <option value="<?php echo $currency['Id'] ?>"><?php echo $currency['CurrencyName']; ?></option>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </select>
                                        </li>

                                        <!-- Custom TAX container -->
                                        <li id="taxFieldsContainer" class="li_taxFields clearfix"></li>
                                        <li>
                                            <label>Total</label>
                                            <input id="newExpense3_oneExpense_amount" name="amount" class="required short" type="text">
                                        </li>
                                        <li style="display: list-item;" class="checkbox" id="newExpense3_on_nightLine">
                                            <input value="" id="claimCustomer" name="claimCustomer" type="checkbox">
                                            <label for="claimCustomer" id="claimCustomer" class="qtip">Claim Customer</label>
                                        </li>                                        
                                        <!-- Custom expense fields container -->
                                        <li id="expenseFieldsContainer"></li>
                                        <li>
                                            <label>Category</label>
                                            <select name="category" class="long">
                                                <?php foreach ($categories as $category): ?>
                                                    <?php if ($category['IsChildren'] == 1): ?>
                                                        <option value="<?php echo $category['Id'] ?>"><?php echo '&nbsp;---&nbsp;' . $category['CategoryName']; ?></option>
                                                    <?php else: ?>
                                                        <option value="<?php echo $category['Id'] ?>"><?php echo $category['CategoryName']; ?></option>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </select>
                                        </li>
                                        <li>
                                            <label>Description</label>
                                            <textarea name="item_description" rows="2" cols="10" ></textarea>

                                        </li>
                                        <li>
                                            <label>Comment</label>
                                            <input maxlength="256" name="comment" type="text">
                                        </li>
                                        <li id="dialog_newExpense3_chooseReport_expense">
                                            <label>Report</label>
                                            <select name="reportID" class="reportSelector long"  id="newExpense_reportDialog">
                                                <option value="-1">---SELECT REPORT---</option>
                                                <?php foreach ($reports as $report): ?>
                                                    <option value="<?php echo $report['Id'] ?>"><?php echo $report['ReportName']; ?></option>
                                                <?php endforeach; ?>
                                                <option disabled="disabled" class="separator" value="">----------</option>
                                                <option value="1">(create new report)</option></select>
                                        </li>
                                    </ol>
                                </form>
                            </div>
                            <!---create report dialog expenses--->
                            <div class="dialog" id="dialog_prompt_report"  style="display: none;">
                                dialog_prompt
                            </div>
                            <!-- Few Mileage -->
                            <div style="display: none;" class="js_modeContainer" id="newExpense3_mileageForm">
                                <!-- One Mileage -->
                                <form  id="newExpenseMileageForm" class="form short-labels js_modeContainer">
                                    <ol>
                                        <li>
                                            <label>Date</label>
                                            <input value="<?php echo date('Y-m-d') ?>" id="created" name="created" class="required calendar semwal_dtpicker" type="text">
                                        </li>
                                        <li>
                                            <label>Merchant</label>
                                            <input value="" id="newExpense3_oneMileage_merchant" name="merchant" type="text" maxlength="255">
                                        </li>                                    
                                        <li>
                                            <label>From</label>
                                            <input id="newExpense3_oneMileage_fromPosition" name="fromPosition"  type="text" value="">
                                        </li>
                                        <li>
                                            <label>To</label>
                                            <input id="newExpense3_oneMileage_toPosition" name="toPosition"  type="text" value="">                                            
                                        </li>                                    
                                        <li>
                                            <label>Distance</label>
                                            <input name="miles" id="newExpense3_oneMileage_count" class="required short qtip" type="text">
                                            <select name="unit" id="newExpense3_oneMileage_unit" class="marginLeft5">
                                                <option value="km">km</option>
                                                <option value="m">m</option>
                                            </select>
                                            <input type="hidden" id="hidden_distanceRatePerKilometer"  value="<?php echo round($defaultPreference['UnitDistanceRatePerKilometer'], 2); ?>">
                                            <input type="hidden" id="hidden_distanceRatePerMile"  value="<?php echo round($defaultPreference['UnitDistanceRatePerMile'], 2); ?>">
                                            <input type="hidden" id="defaultCurrency" value="<?php echo $defaultPreference['CurrencyName']; ?>">
                                            <span class="rate" id="newExpense3_mileageRate">at <a href="/settings/preference" alt="Change Mileage Preferences" title="Change Mileage Preferences"><?php echo round($defaultPreference['UnitDistanceRatePerKilometer'], 2) . ' ' . $defaultPreference['Symbol']; ?></a> per km.</span>
                                        </li>
                                        <li>
                                            <label>Currency</label>
                                            <input type="hidden" id="newExpense3_oneMileage_currency_old" value="<?php echo $defaultPreference['CurrencyId']; ?>">
                                            <select name="expenseCurrency" class="short" id="newExpense_oneMileage_currency">
                                                <?php foreach ($currencies as $currency): ?>
                                                    <?php if ($currency['Id'] == $defaultPreference['CurrencyId']): ?>
                                                        <option value="<?php echo $currency['Id'] ?>" selected="selected"><?php echo $currency['CurrencyName']; ?></option>
                                                    <?php else: ?>
                                                        <option value="<?php echo $currency['Id'] ?>"><?php echo $currency['CurrencyName']; ?></option>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </select>
                                        </li>
                                        <li>
                                            <label>Amount</label>
                                            <input name="amount" id="newExpense3_oneMileage_amount" class="short qtip"  type="text">
                                            <span id="newExpense3_mileage_currency"></span>
                                        </li>

                                        <li style="display: list-item;" class="checkbox" id="newExpense3_mileage_claimCustomer">
                                            <input value="" id="claimCustomer" name="claimCustomer" type="checkbox">
                                            <label for="claimCustomer">Claim Customer</label>
                                        </li>

                                        <div id="mileage_billable_invoicing_ad" > </div>


                                        <li>
                                            <label>Category</label>
                                            <select  name="category" class="long qtip">
                                                <?php foreach ($categories as $category): ?>
                                                    <?php if ($category['IsChildren']): ?>
                                                        <option value="<?php echo $category['Id'] ?>"><?php echo '&nbsp;---&nbsp;' . $category['CategoryName']; ?></option>
                                                    <?php else: ?>
                                                        <option value="<?php echo $category['Id'] ?>"><?php echo $category['CategoryName']; ?></option>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </select>
                                        </li>
                                        <li>
                                            <label>Description</label>
                                            <textarea name="item_description" rows="2" cols="10"></textarea>

                                        </li>

                                        <li>
                                            <label>Comment</label>
                                            <input maxlength="256" name="comment" type="text">
                                        </li>
                                        <li id="dialog_newExpense3_chooseReport_mileage">
                                            <label>Report</label>
                                            <select name="reportID" class="reportSelector long">
                                                <option value="-1">---SELECT REPORT---</option>
                                                <?php foreach ($reports as $report): ?>
                                                    <option value="<?php echo $report['Id'] ?>"><?php echo $report['ReportName']; ?></option>
                                                <?php endforeach; ?>
                                                <option disabled="disabled" class="separator" value="">----------</option>
                                                <option value="1">(create new report)</option>
                                            </select>
                                        </li>
                                    </ol>
                                </form>

                            </div>
                            <div style="display: none;"  class="js_modeContainer" id="newExpense3_timeForm">
                                <!-- One Hour -->
                                <form  id="newExpenseTimeForm" class="form short-labels js_modeContainer"><ol>
                                        <li>
                                            <label>Date</label>
                                            <input value="<?php echo date('Y-m-d'); ?>" id="created" name="created" class="required calendar semwal_dtpicker" type="text">
                                        </li>
                                        <li>
                                            <label>Merchant</label>
                                            <input value="" id="newExpense3_oneTime_merchant" name="merchant" type="text" maxlength="255">
                                        </li>  
                                        <li>
                                            <label>Hours</label>
                                            <input name="hour" id="newExpense3_oneTime_hours" class="required short qtip" type="text">
                                        </li>

                                        <li>
                                            <label>Hourly Rate</label>
                                            <input value="<?php echo $defaultPreference['TimeDefaultHourlyRate'] ?>" name="rate" id="newExpense3_oneTime_rate" class="required short qtip" type="text">
                                        </li>
                                        <li>
                                            <label>Currency</label>
                                            <input type="hidden" id="newExpense3_oneTime_currency_old" value="<?php echo $defaultPreference['CurrencyId']; ?>">
                                            <select name="expenseCurrency" class="short" id="newExpense_oneTime_currency">
                                                <?php foreach ($currencies as $currency): ?>
                                                    <?php if ($currency['Id'] == $defaultPreference['CurrencyId']): ?>
                                                        <option value="<?php echo $currency['Id'] ?>" selected="selected"><?php echo $currency['CurrencyName']; ?></option>
                                                    <?php else: ?>
                                                        <option value="<?php echo $currency['Id'] ?>"><?php echo $currency['CurrencyName']; ?></option>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </select>
                                        </li>
                                        <li>
                                            <label>Amount</label>
                                            <input name="amount" id="newExpense3_oneTime_amount" class="short qtip"  type="text">
                                        </li>
                                        <li style="display: list-item;" class="checkbox" id="newExpense3_time_claimCustomer ">
                                            <input value="" id="claimCustomer " name="claimCustomer" type="checkbox">
                                            <label for="claimCustomer ">Claim Customer</label>
                                        </li> 
                                        <li>

                                            <label>Category</label>
                                            <select  name="category" class="long qtip">
                                                <?php foreach ($categories as $category): ?>
                                                    <?php if ($category['IsChildren']): ?>
                                                        <option value="<?php echo $category['Id'] ?>"><?php echo '&nbsp;---&nbsp;' . $category['CategoryName']; ?></option>
                                                    <?php else: ?>
                                                        <option value="<?php echo $category['Id'] ?>"><?php echo $category['CategoryName']; ?></option>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            </select>
                                        </li>
                                        <li>
                                            <label>Description</label>
                                            <textarea name="item_description" rows="2" cols="10"></textarea>

                                        </li>
                                        <li>
                                            <label>Comment</label>
                                            <input maxlength="256" name="comment" type="text">
                                        </li>
                                        <li id="dialog_newExpense3_chooseReport_time">
                                            <label>Report</label>
                                            <select name="reportID" class="reportSelector long">
                                                <option value="-1">---SELECT REPORT---</option>
                                                <?php foreach ($reports as $report): ?>
                                                    <option value="<?php echo $report['Id'] ?>"><?php echo $report['ReportName']; ?></option>
                                                <?php endforeach; ?>
                                                <option disabled="disabled" class="separator" value="">----------</option>
                                                <option value="1">(create new report)</option>
                                            </select>
                                        </li>
                                    </ol>
                                </form>

                            </div>
                        </div>
                        <div class="floatRight center receiptSide" id="receiptSide">
                            <div class="receiptContainer"> 
                                <div id="receipt_20603663" class="receipt_wrapper ">
                                    <div class="receipt OPEN attached"><span 
                                            class="receiptID"><span class="transactionID"></span><img id="newExpenseReceiptImgId" src="<?php echo $baseUrl ?>/images/icon-receipt_150_new.png" class="receiptimage">
                                            <a href="<?php echo $baseUrl ?>/images/icon-receipt_150_new.png" class="fancy"></a></span></div>
                                </div>	
                                <div id="detach" class="button js_detach receiptDetach hidden"><a>Detach</a></div>
                                <div id ="open_dialog_receipts3_panel" class="button add js_attach"><a id="open_dialog_receipts3" href="#">Attach</a></div>


                            </div>	
                            <input type="hidden" value="" name="newExpenseReceiptId" id="newExpenseReceiptId" />
                        </div>

                        <!-- Multiple-->
                        <div  style="display: none;"  class="js_modeContainer" id="newExpense3_multipleForm" >
                            <form id="newExpenseMultipleForm">
                                <input type="hidden" id="multiple_number_row" name="multiple_number_row" value="8">
                                <table class="display" id="newExpense3_expenseTable" border="0" cellpadding="0" cellspacing="1">
                                    <thead>
                                        <tr>
                                            <th style="width: 0px;" class="created  sorting_disabled">Date</th>
                                            <th style="width: 0px;" class="merchant  sorting_disabled">Merchant</th>
                                            <th style="width: 0px;" class="billable  sorting_disabled">Claim Customer</th>
                                            <th style="width: 0px;" class="amount  sorting_disabled">Total</th>
                                            <th style="width: 0px;" class="currency  sorting_disabled"></th>
                                            <th style="width: 0px;" class="receipt  sorting_disabled"></th>
                                            <th style="width: 0px;" class="category  sorting_disabled">Category</th>
                                            <th style="width: 0px;" class="description  sorting_disabled">Description</th>
                                            <th style="width: 0px;" class="comment  sorting_disabled">Comment</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        <?php for ($i = 0; $i < 8; $i++): ?>
                                            <tr id="newExpense3_expenseTable_staging_<?php echo $i; ?>" class="odd hoverable multiple_expense_row">
                                                <td class="datecolumn editable"><input value="<?php echo date('Y-m-d'); ?>" id="date_<?php echo $i; ?>" name="created_<?php echo $i; ?>" class="required calendar semwal_dtpicker" type="text"></td>
                                                <td class="merchantcolumn editable"><input value="" id="merchant_<?php echo $i; ?>" name="merchant_<?php echo $i; ?>" class="required short" type="text" maxlength="255"></td>
                                                <td valign="center"  class="billablecolumn editable"><input type="checkbox" name="customerClaim_<?php echo $i; ?>"> </td>
                                                <td class="amountcolumn editable"><input style="width: 15px;" type="text" value="" id="amount_<?php echo $i; ?>" name="amount_<?php echo $i; ?>" /></td>
                                                <td class="currencycolumn editable">
                                                    <select name="currency_<?php echo $i; ?>">
                                                        <?php foreach ($currencies as $currency): ?>
                                                            <?php if ($currency['Id'] == $defaultPreference['CurrencyId']): ?>
                                                                <option value="<?php echo $currency['Id'] ?>" selected="selected"><?php echo $currency['CurrencyName']; ?></option>
                                                            <?php else: ?>
                                                                <option value="<?php echo $currency['Id'] ?>"><?php echo $currency['CurrencyName']; ?></option>
                                                            <?php endif; ?>
                                                        <?php endforeach; ?>
                                                    </select>
                                                </td>

                                                <td class="receiptcolumn"><span class="addReceiptIcon" id="receiptIcon_<?php echo $i; ?>">&nbsp;</span><input type="hidden" value="" name="mutilReceiptId_<?php echo $i; ?>" id="mutilReceiptId_<?php echo $i; ?>"></td>
                                                <td class="categorycolumn editable">
                                                    <select class="long" name="category_<?php echo $i; ?>" >
                                                        <?php foreach ($categories as $category): ?>
                                                            <?php if ($category['IsChildren']): ?>
                                                                <option value="<?php echo $category['Id'] ?>"><?php echo '&nbsp;---&nbsp;' . $category['CategoryName']; ?></option>
                                                            <?php else: ?>
                                                                <option value="<?php echo $category['Id'] ?>"><?php echo $category['CategoryName']; ?></option>
                                                            <?php endif; ?>
                                                        <?php endforeach; ?>
                                                    </select>
                                                </td>                                      
                                                <td class="descriptioncolumn editable"><input type="text" name="description_<?php echo $i; ?>" /></td>
                                                <td class="commentcolumn editable"><input type="text" name="comment_<?php echo $i; ?>" />
                                                    <input type="hidden" name="receiptId_<?php echo $i; ?>"  value=""/>
                                                </td>
                                            </tr>
                                        <?php endfor; ?>

                                    </tbody>
                                </table>

                            </form>
                        </div>

                        <input type="hidden" id="mutilReceiptIdCurrent" value="">

                    </div>


                </div>
                <!-- Few Buttons -->
                <div class="floatWrapper marginTop marginBottom center">
                    <div class="button floatLeft js_reset hidden" id="btnAddNewRow"><a>Add new row</a></div>
                    <div class="button add js_save" id="btnNewExpenseSave"><a href="#">Save</a><img  class="hide" id="sipnner_newexpense" alt="uploading" src="<?php echo $baseUrl; ?>/images/spinner_2x.gif"></div>
                    <div class="button add js_save" id="btnReset"><a>Reset</a></div>                            
                </div>


            </div>
        </div>
        <img id="cachedSpinner" class="js_spinner hidden" src="Expensify%20-%20Expenses1_files/spinner.gif"></div>

    <div class="dialog dialog_new" id="dialog_1">
        <div class="dialog_title">
            <a class="dialog_x" href="#">X</a>
            <h1 class="dialog_title_text">Hmmm</h1>
        </div>
        <div class="dialog_body dialog_wrapper">
            <center>Please select exactly <strong>2 (two)</strong> expenses to merge.</center>
        </div>
    </div>
</div>

